import logging

import pytest

from api.ihrmLoginApi import IhrmLoginApi
from common.assertTools import common_assert
from common.readJsonTools import read_json_file
from config import project_pach

'''定义 ihrm 登录接口测试类'''
class TestIhrmLogin(object):
    def setup_class(self):
        self.ihrm_login = IhrmLoginApi()

    filename = project_pach + "/data/ihrmLoginData.json"
    data = read_json_file(filename)

    @pytest.mark.parametrize("desc,req_boda,status_code,success,code,message", data)
    def test_ihrm_login(self, desc, req_boda, status_code, success, code, message):
        resp = self.ihrm_login.login(req_boda)
        # print(f"{desc}:{resp.json()}")
        logging.info(f"{desc}:{resp.json()}")
        common_assert(resp, status_code, success, code, message)



